﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Services;
using System.Diagnostics;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceProcess;
using System.Text;

namespace PersonaliiService
{
// ReSharper disable InconsistentNaming
	partial class WCFService : ServiceBase
// ReSharper restore InconsistentNaming
	{
		private WebServiceHost _host;

		public WCFService()
		{
			InitializeComponent();
		}

		protected override void OnStart(string[] args)
		{
			_host = new WebServiceHost(typeof(PersonaliiService), new Uri("http://localhost:9999/Personalii"));
			WebHttpBinding binding = new WebHttpBinding();
			_host.AddServiceEndpoint(typeof(IRequestHandler), binding, "WebServiceHost");
			_host.Open();
			//Console.WriteLine("Service at http://localhost:9999/Personalii started");
		}

		protected override void OnStop()
		{
			_host.Close();
		}
	}
}
